
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
       char *pArgv[] = {
           " ",
            "",
            "4000"  // 服务器的端口
       };
       struct sockaddr_in m_AddrDest = {0};
       int    m_AddrDestLen = sizeof(struct sockaddr_in);

       int m_Socket = 0;
       if((m_Socket = socket(AF_INET, SOCK_STREAM, 0))<=0){
              perror("创建Socket失败！\n");
              exit(1);
       }
    // 地址
       m_AddrDest.sin_family = AF_INET; // 和服务器端在同一台机器上
       m_AddrDest.sin_port = htons(atoi(pArgv[2]));
       m_AddrDest.sin_addr.s_addr = INADDR_ANY;
    // 连接服务器--此处是代理服务器
       if(connect(m_Socket,(struct sockaddr*)&m_AddrDest, m_AddrDestLen)<0){
              printf("failed to connect FtpProxy!\n");
              close(m_Socket);
              exit(1);
       }
       char pBuf[512*1024] = {0};
       int  ret = 0;
       while(1){
              ret = recv(m_Socket, pBuf, 512*1024-1, 0);
              printf("client get from FtpServer: %s\n", pBuf);
              printf("Please input the info\n");
              //gets(pBuf);
              //printf("sending...\n");
              //send(m_Socket, pBuf,ret,0);
       }
       return 0;
}
